import React, { PureComponent } from "react"

export class App extends PureComponent {
    constructor() {
        super()
        this.state = {
            message: "",
        }
    }

    changeHandle(e) {
        console.log(e.target.value)
        this.setState({
            message: e.target.value,
        })
    }

    render() {
        const { message } = this.state
        return (
            <div>
                {/* 非受控组件 */}
                <input type="text" value={message} onChange={(e) => this.changeHandle(e)} />
                <h2>message:{message}</h2>
                {/* 受控组件 */}
                {/* <input type="text" value={message}  /> */}
            </div>
        )
    }
}

export default App
